﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="userrecord.aspx.cs" Inherits="EZCRS.HCMS.Web.manage.booklog.userrecord" %>
<%@ Register assembly="Book38.Net.CustomControl" namespace="Book38.Net.CustomControl" tagprefix="cc2" %>
<%@ Register Src="../usercontrol/titlepage.ascx" TagName="titlepage" TagPrefix="uc2" %>
<%@ Register Src="../usercontrol/jspage.ascx" TagName="jspage" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
      <title></title>
     
      <script src="../../Common/base_grid.js" language="javascript" type="text/javascript"></script>  
   <style type="text/css">
<!--
#Layer1 {
	position:absolute;
	width:365px;
	height:140px;
	z-index:100;
	left: 35%;
	top: 40%;
	background-color:#eeeeee;
}
-->
</style>
</head>
<body onload="Page_Load('First')">
<form id="form1" runat="server">
<div id="Layer1" style="display:none">
  <table border="0" cellspacing="0" cellpadding="0" style="border:solid 1px #B9CEEA;margin:5px;width:355px;background-color:White">
    <tr class="title1" style="background-color:#B9CEEA;">
      <td colspan="2">
          <asp:Label ID="Label3" runat="server" Text="<%$ Resources:Site, SearchDetail %>"></asp:Label></td>
      <td width="9%">&nbsp;</td>
      <td width="9%"><img src="../../Image/loading_close.gif" width="19" height="19" style="cursor:hand;" onclick="javascript:showsearchbox();"/></td>
    </tr>
    <tr>
      <td width="25%" height="25"><div align="right">
          <asp:Label ID="Label4" runat="server" Text="<%$ Resources:Site, ConfirmNo %>"></asp:Label>：</div></td>
      <td colspan="3">&nbsp;
          <cc2:WebTextBox ID="uorder" runat="server" CssClass="text-line" Width="150px"></cc2:WebTextBox></td>
    </tr>
    <tr>
      <td height="25"><div align="right">
          <asp:Label ID="Label1" runat="server" Text="<%$ Resources:Site, BookDate %>"></asp:Label>：</div></td>
      <td colspan="3">&nbsp;
                      <input id="bstart" class="text-line" readonly="readonly" style="width: 66px" type="text" />&nbsp;<asp:Image
                          ID="Image1" runat="server" ImageAlign="Top" ImageUrl="~/Image/calendar.gif" Style="cursor: hand" />
                      -
                      <input id="bend" class="text-line" readonly="readonly" style="width: 66px" type="text" />
                      <asp:Image ID="Image2" runat="server" ImageAlign="Top" ImageUrl="~/Image/calendar.gif"
                          Style="cursor: hand" />
      </td>
    </tr>
    <tr>
      <td height="25"><div align="right">
          <asp:Label ID="Label2" runat="server" Text="<%$ Resources:Site, CheckInDate %>"></asp:Label>：</div></td>
      <td colspan="3">&nbsp;
                      <input id="cstart" class="text-line" readonly="readonly" style="width: 66px" type="text" />
                      <asp:Image ID="Image3" runat="server" ImageAlign="Top" ImageUrl="~/Image/calendar.gif"
                          Style="cursor: hand" />
                      -
                      <input id="cend" class="text-line" readonly="readonly" style="width: 66px" type="text" />
                      <asp:Image ID="Image4" runat="server" ImageAlign="Top" ImageUrl="~/Image/calendar.gif"
                          Style="cursor: hand" />
      </td>
    </tr>
    <tr>
      <td height="25"><div align="right">
          <asp:DropDownList ID="ordersort" runat="server">
          </asp:DropDownList></div></td>
      <td colspan="3">&nbsp;<input type="button" value="Search" class="bttn" onclick="subshowbooking('First');showsearchbox();"></td>
    </tr>
  </table>
</div>
    
    
        <uc2:titlepage id="Titlepage1" runat="server" inittitle="<%$ Resources:Site, UserRecord %>"></uc2:titlepage>
        
        <table class="main-table"  cellpadding="1" cellspacing="1">
            <tr class="line-even">
                <td style="width:10%; text-align: right;">
              </td>
                <td width="19%" style="text-align: right;"><asp:DropDownList ID="ddlsort" runat="server">
                        <asp:ListItem Value="3" Text="<%$ Resources:Site, LabCardUserUnumber %>"></asp:ListItem>
                        <asp:ListItem Value="0" Selected Text="<%$ Resources:Site, LabCardUserUsrName %>"></asp:ListItem>
                        <asp:ListItem Value="2" Text="<%$ Resources:Site, LabCardUserUsrEmail %>"></asp:ListItem>
                        <asp:ListItem Value="1" Text="<%$ Resources:Site, LabCardUserUsrMobile %>"></asp:ListItem>
                    </asp:DropDownList>
              </td>
                <td style="width:10%; text-align: right;">
                    <cc2:WebTextBox ID="uname" runat="server" CssClass="text-line" Width="150px"></cc2:WebTextBox></td>
                <td style="width:30%; text-align: left;">
                    &nbsp;
                <asp:Button  ID="BtnSearch"  runat="server" CssClass="bttn" OnClientClick="javascript:Page_Load('Search');return false;" Text="<%$ Resources:Site, ButtonSearch %>" /></td> 
                <td style="width: 20%">
              </td>
            </tr>
        </table>
    <input type="hidden" id="txt_sql" value="" />
    <input type="hidden" id="usort" value="0"/>
    <input type="hidden" id="subuid" value="0"/>
    <input type="hidden" id="subusort" value="0" />
    </form>
  <br /><uc1:jspage id="Jspage1" runat="server">
</uc1:jspage>
   <script type="text/javascript">
    function Page_Load(pageindex)
    {//debugger
        var sstr=$F("uname").value;
        var utype=$F("ddlsort").value;
        var ssort=$F("usort").value;
        pageindex=pageIndexSetting(pageindex);    //pageindex的设定
        EZCRS.HCMS.myajax.CardUserLog.CardUserList(pageindex, sstr,utype,ssort,setTable);
        pageLastSetting(sstr,pageindex);     //最后的赋值
    }
    
    function setorders(orderstr)
    {
    if($F("usort").value==orderstr)
    {
     $F("usort").value=orderstr+orderstr;
     }
     else
     {
     $F("usort").value=orderstr;
     }
     Page_Load("First");
    }
    
    //////////////////////===============================================///////////////////////////
    //每一个用户的列表
    function subshow(suid)
    {//debugger
      //隐藏所有
      var allid=$F("alluserid").value.split(',') ;
      for(i=0;i<allid.length;i++)
      {
       if(allid[i]!=""　&& allid[i]!=suid)
       {
        $F("tabk"+allid[i]).style.display='none';
        $F("bk"+allid[i]).innerHTML='';
        $F("bottom"+allid[i]).innerHTML='';
       }
      }
      
      $F("subuid").value=suid;
      
      if($F("tabk"+suid).style.display=='')
      {
        $F("tabk"+suid).style.display='none';
        //$("#tabk"+suid).hide("slow);
      }
      else
      {
        $F("tabk"+suid).style.display='';
        if($F("bottom"+suid).innerHTML=='')
        {
          $F("bottom"+suid).innerHTML=subShowLink();
          subshowbooking('First');
        } 
      }
      
    }
    //分页显示
    function subshowbooking(pageindex)
    {//debugger
       var subustr="";
       subustr+=$F("uorder").value+'|';
       subustr+=$F("bstart").value+'|';
       subustr+=$F("bend").value+'|';
       subustr+=$F("cstart").value+'|';
       subustr+=$F("cend").value+'|';
       subustr+=$F("ordersort").value;
       
       
       pageindex=subpageIndexSetting(pageindex);
       $F('subtxtPageIndex').value=parseInt(pageindex,10);
       EZCRS.HCMS.myajax.CardUserLog.CardUserBooking(pageindex,$F('subuid').value,subustr,$F('subusort').value,SubsetTable);
       
    }
    function SubsetTable(rep)
    {
    //debugger
        var Record=rep.value;
        if(Record!=null)
        {
           var sysRecord=Record[0];
 
          $F('subtxtPageCount').value=Record[1];
          $F('subtxtRecordCount').value=Record[2];
          $F('bk'+$F('subuid').value).innerHTML=sysRecord;

          subShowLike();
        }
    }
    
    function subShowLink()
    {
        str="<table width=\"100%\" border=\"0\"  align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color:#B9CEEA\">";
        str+="<tr><td style=\"width:100px;\"><input type=\"button\" value=\"Search\" class=\"bttn\" onclick=\"showsearchbox();\"></td>";
        str+="<td style=\"height: 10px\">";
        str+="    <div align=\"right\">";
        str+="        <table id=\"pageIndex\" width=\"70%\">";
        str+="            <tr>";
        str+="                <td align=\"right\" style=\"width: 203px; height: 28px;\">";
        str+="                    共";
        str+="                    <input id=\"subtxtPageCount\" readonly=\"readonly\" style=\"background-image: none; width: 25px;   cursor: text; border-top-style: none; border-right-style: none; border-left-style: none;                 background-color: transparent; text-align:center; border-bottom-style: none\" type=\"text\" />";
        str+="                    页";
        str+="                    <input id=\"subtxtRecordCount\"  readonly=\"readonly\" style=\"background-image: none; width: 30px; cursor: text;  border-top-style: none; border-right-style: none; border-left-style: none; background-color: transparent;text-align:center; border-bottom-style: none\" type=\"text\" />  条信息";
        str+="                    </td>";
        str+="                <td style=\"height: 28px\">";
        str+="                转到第<input id=\"subtxtPageIndex\" type=\"text\" style=\"width: 25px; background-color: transparent; background-image: none; cursor: text;text-align:center;\" onkeypress='return getNumber(event)' />页</td><td style=\"height: 28px\"><input type=\"button\" class=\"bttn\" value=\"Go\" onClick=\"subshowbooking('Search')\"/></td>";
        str+="                <td style=\"height: 28px\"><a href=\"javascript:subshowbooking('First')\" id=\"subtdFirst\">首页</a></td>";
        str+="                <td style=\"height: 28px\"><a href=\"javascript:subshowbooking('Above')\" id=\"subtdAbove\">上一页</a></td>";
        str+="                <td style=\"height: 28px\"><a href=\"javascript:subshowbooking('Next')\" id=\"subtdNext\">下一页</a></td>";
        str+="                <td style=\"height: 28px\"><a href=\"javascript:subshowbooking('Last')\" id=\"subtdLast\">末页</a>";
        str+="                </td>";
        str+="            </tr>";
        str+="        </table>";
        return str;
    }
    
    function showsearchbox()
    {
     if($F("Layer1").style.display=='')
     {
       $F("Layer1").style.display='none';
       $F("uorder").value='';
       $F("bstart").value='';
       $F("bend").value='';
       $F("cstart").value='';
       $F("cend").value='';
       $F("ordersort").value='0';
     }
     else
     {
       $F("Layer1").style.display='';
     }
    }
    
    function subShowLike()
    {
     //进入时启用 首页,初始 末页,下一页
       $F('subtdFirst').style.color="#3366ff";
       $F('subtdAbove').style.color="#3366ff";     
       $F('subtdNext').style.color="#3366ff";
       $F('subtdLast').style.color="#3366ff";
               
       $F('subtdNext').style.cursor='pointer'; 
       $F('subtdLast').style.cursor='pointer';
       $F('subtdFirst').style.cursor='pointer'; 
       $F('subtdAbove').style.cursor='pointer';  
       
       //获取总页数与页码
       iPageCount =$F('subtxtPageCount').value;
       iPageIndex =$F('subtxtPageIndex').value;
       //显示或隐藏转页链接
        if (iPageIndex == iPageCount)
        {
            $F('subtdNext').style.cursor='normal'; 
            $F('subtdLast').style.cursor='normal';
            $F('subtdNext').style.color="lightgrey";
            $F('subtdLast').style.color="lightgrey";
        }
        if (iPageIndex == 1)
        {  
         $F('subtdFirst').style.color="lightgrey";
         $F('subtdAbove').style.color="lightgrey";  
         $F('subtdFirst').style.cursor='normal'; 
         $F('subtdAbove').style.cursor='normal';    
        }
    }
    
    function subpageIndexSetting(pageindex)
{
      if(pageindex=='First'|| pageindex=='submit')
    {
        pageindex=1
    }
    else //末页.设置索引为最大页
    if(pageindex=='Last')
    {
    pageindex=$F('subtxtPageCount').value 
    }
    else//前页
    if(pageindex=='Above')
    {
      pageindex=parseInt($F('subtxtPageIndex').value,10)-1
    
    }
    else//后翻页
    if(pageindex=='Next')
    {
      pageindex=parseInt($F('subtxtPageIndex').value,10)+1
    }
    else//查询页
    if(pageindex=='Search')
    {
     pageindex=parseInt($F('subtxtPageIndex').value,10)
    }
    if(pageindex<1)//如果小于1.前页无效
    {
    pageindex=1
    }
    else //大于等于总页数,末页无效,索引设置为最大页去1.此时pageindex!=1的条件是为了防止页加载时进入判断,因为页加载时document.getElementById('txtPageCount').value为Nan
    if(pageindex!=1 && pageindex>=$F('subtxtPageCount').value)
    {   
        pageindex=$F('subtxtPageCount').value
    } 
    return pageindex;
}
    /////////////////////////=========================================///////////////////////////////
    AjaxPro.timeoutPeriod = 40000;
    var l = $F("loadinfo");
    AjaxPro.onLoading = function(b)
    {
      if(l.innerHTML=="")
        l.innerHTML="<img src=\"../../Image/loading.gif\" alt=\"Loading\" align=\"absmiddle\" /><%= Resources.Site.LabLoadInfo %>";
    }    
    AjaxPro.onError = function(e) 
    {
        l.innerHTML="<%= Resources.Site.LabLoadErrInfo %>";
    } 
    AjaxPro.onTimeout = function(t) 
    {
        l.innerHTML="<%= Resources.Site.LabLoadErrInfo %>";
    }
    
    
   </script> 
   
</body>
</html>




